package com.tongsys.server.utils;

import io.swagger.annotations.ApiOperation;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@ApiOperation("用于将字符串渲染到客户端")
public class WebUtils {
    public static String renderString(HttpServletResponse response,String str){
        try {
            response.setStatus(200);
            response.setCharacterEncoding("utf-8");
            response.setContentType("application/json");
            //输出到客户端
            response.getWriter().print(str);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
